<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./js/vue.js"></script>
    <title>天气-监视</title>
    <style> 
       
    </style>
</head>
<body>
    <div id="root">
        
        <h1>今天天气很{{info}}</h1>
        <br>
        <button @click="change">切换天气</button>
        <!-- 绑定事件的时候:@xxx='yyy',yyy可以写一些简单的语句 -->
        <button @click="isHot =!isHot">切换天气</button>
        <button @click="alert(1)">切换天气</button>
        <button @click="window.alert(2)">切换天气</button>
    </div>
</body>
<script>
    var vm = new Vue({
        el: '#root',
        data: {
            isHot: true,
            window:window
        },
        methods: {
            change() {
                this.isHot =!this.isHot;
            }
        },
        computed: {
            info(){
                return this.isHot? '炎热' : '凉爽';
            }
        }
    })          
</script>
</html>